{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4fb8897b",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Author:luoyu\n",
    "# 时间：0930-week5\n",
    "# 主要知识: 列表入门\n",
    "\n",
    "use_data = \"luoyu||royu||roe||luofeiyu\"\n",
    "print(user_data[1])\n",
    "\n",
    "# 引入列表\n",
    "user_data_list = [[\"luoyu\",123456,19],[\"royu\",654321,18],[\"roe\",666666,17],[\"luofeiyu\",888888,16]]\n",
    "# password_list = [123456,654321,666666,888888]\n",
    "# age = [19,18,17,16]\n",
    "# 1. 从左到右取值(index & slice)\n",
    "print(user_data_list[2])\n",
    "# 切片 slice , 右边的值取不到 例如[0:3] 索引为3的值取不到\n",
    "print(user_data_list[0:3])\n",
    "\n",
    "# -3, -2, -1, 0, 1, 2, 3, 4..\n",
    "# 2. 从右往左取值(index & slice)\n",
    "print(user_data_list[-2])\n",
    "# 切片 slice , 右边的值取不到\n",
    "print(user_data_list[-3:-1])\n",
    "\n",
    "# 如果要取到最后一个值, 不能为0, 直接省略不写\n",
    "print(user_data_list[-3:0])\n",
    "print(user_data_list[-3:])\n",
    "\n",
    "# ****重要****\n",
    "print(user_data_list[:])\n",
    "\n",
    "# 步长, list列表slice : [start:stop:step]\n",
    "'''\n",
    "如果没有指定开始值，则默认为0:\n",
    "如果没有指定结束值，则取列表允许的最大值:\n",
    "如果没有指定步长值，则默认步长为1.\n",
    "'''\n",
    "print(list(range(10)))\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
